<?php
$v_cate_type="CATE";
if(isset($_REQUEST['type_cate'])){
	$v_cate_type=$_REQUEST['type_cate'];
}

switch($v_cate_type) {
	case "CATE";
		$v_title = CONST_QA_LIST_ALL_CATE_TITLE;
		$v_send_qa  = CONST_QA_QUESTION_FOR_ANSWER_TITLE;
		$v_qa_empty = CONST_QA_EMPTY_QA_BY_CATE_LABEL;
		$v_dsp_list_cate = "block";
	break;
	case "IDEA";
		$v_title = CONST_QA_LIST_IDEA_TITLE;
		$v_send_qa  = CONST_QA_QUESTION_FOR_IDEA_TITLE;
		$v_qa_empty = "";
		$v_dsp_list_cate = "none";
		$v_cate_id =115;
	break;
	case "RESULT";
		$v_title = CONST_QA_LIST_RESULT_TITLE;
		$v_send_qa  = CONST_QA_QUESTION_FOR_RESULT_TITLE;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		$v_cate_id =116;
	break;
	case "OTHER";
		$v_title = CONST_QA_LIST_OTHER_TITLE;
		$v_send_qa  = CONST_QA_QUESTION_FOR_ANSWER_TITLE;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		$v_cate_id =114;
	break;
	case "REGISTER";
		$v_title = CONST_QA_LIST_REGISTER_TITLE;
		$v_send_qa  = CONST_QA_QUESTION_FOR_REGISTER_TITLE;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		$v_cate_id =117;
	break;
}


$v_status = 2;
$v_method = 1;
$v_filter = "";
$v_agency_id = 0;

if(isset($_REQUEST['hdn_cate_id'])){
$v_cate_id =$_REQUEST['hdn_cate_id'];
}

$v_date_start_sp = "";
$v_date_end_sp = "";

$v_limit = CONST_NUMBER_OF_QA_PER_PAGE;

if(isset($_REQUEST['hdn_page'])){
	$v_page=$_REQUEST['hdn_page'];
}else
	$v_page=1;
if(_is_sqlserver()){
	$sql = "Exec Onegate_QAGetAllPerPage " ;
	$sql = $sql.$v_status.",";
	$sql = $sql.$v_method.",";
	$sql = $sql."'".$v_filter."',";
	$sql = $sql.$v_agency_id.",";
	$sql = $sql.$v_cate_id.",";
	$sql = $sql."'".$v_date_start_sp."',";
	$sql = $sql."'".$v_date_end_sp."'";
	$sql = $sql.",".$v_page;
	$sql = $sql.",".$v_limit;
	//echo $sql; exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$arr_result = $ado_conn->GetAll($sql); 
	$v_qa_count=sizeof($arr_result);
	
	//Lay ten linh vuc
	$cmd = @mssql_init("ONEGATE_CateGetSingle",$conn);
	@mssql_bind($cmd,"@p_cate_id",$v_cate_id,SQLINT4);
	$result = mssql_execute($cmd);
	$arr_single_cate = _get_row_to_array($result);
	//Giai phong bien nho
	@mssql_free_result($result);
	
}
$v_cate_name = $arr_single_cate['0']['2'];
$v_total_qa = intval($arr_result[0]['TOTAL_QA']);

//$v_cate_name = $arr_result[0]['C_NAME'];
?>
